import {
  postForm
} from '../../utils/request'

Page({

  data: {
    basePath: getApp().globalData.basePath,
    doctorList: [],
    caseList: [],
    swiperImgProps: {
      mode: "widthFix"
    }
  },

  onLoad(options) {
    this.loadDoctor();
    this.loadCase();
    this.loadContactMe();
  },
  onReady() {},
  onShow() {},
  onHide() {},
  onUnload() {},
  onPullDownRefresh() {},
  onReachBottom() {},
  onShareAppMessage() {},
  getPhoneNumber(e) {
    console.info(e)
  },
  loadDoctor() {
    postForm({
      url: 'front/api/counselor/banner'
    }).then(doctorList => {
      this.setData({
        doctorList: doctorList
      })
    });
  },
  loadCase() {
    postForm({
      url: 'front/api/case/banner'
    }).then(caseList => {
      caseList.forEach(item => {
        item.img = this.data.basePath + item.img
      });
      this.setData({
        caseList: caseList
      })
    });
  },
  toGoods() {
    wx.switchTab({
      url: '/pages/goods/goods',
    })
  },
  loadContactMe() {
    postForm({
      url: 'front/api/wxwork/contact/get/default'
    }).then(res => {
      this.setData({
        configId: res.configId
      })
    })
  },
})